{extend name="layout"}
{block name="body"}
    <section class="wld-content">
        <div class="page_title">减员信息表</div>
        
        <div class="con_box layui-form">
            
            <form class="layui-form-type layui-form mainForm" data-auto="true" data-callback="submitCallback">
                <div class="con_title">
                    <span class="con_title_line"></span>
                    <span>员工信息</span>
                </div>
                <div class="add-input layui-form-item">
                    <div class="layui-row ">
                        <div class="layui-col-md4">
                            <div class="layui-inline ">
                                <label class="layui-form-label label-required-prev">员工姓名</label>
                                <div class="layui-input-inline seller-inline-input">
                                    <input type="text" name="name" required placeholder="请输入姓名" disabled autocomplete="off" value="{$increase.name|default=""}" class="layui-input ">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md4">
                            <div class="layui-inline ">
                                <label class="layui-form-label label-required-prev">身份证号</label>
                                <div class="layui-input-inline seller-inline-input">
                                    <input type="text" name="id_number" required placeholder="请输入身份证号" disabled autocomplete="off"
                                           value="{$increase.id_number|default=""}"
                                    class="layui-input ">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md4">
                            <div class="layui-inline ">
                                <label class="layui-form-label label-required-prev">手机号码</label>
                                <div class="layui-input-inline seller-inline-input">
                                    <input type="text" name="mobile" required placeholder="请输入电话号码" disabled autocomplete="off"
                                           value="{$increase.mobile|default=""}"
                                    class="layui-input ">
                                </div>
                            </div>
                        </div>
                       
                        <div class="layui-col-md4">
                            <div class="layui-inline layui-form-item ">
                                <label class="layui-form-label label-required-prev">截止日期</label>
                                <div class="layui-input-inline  seller-inline-input input-icon">
									<i class="iconfont iconcontract2-fill"></i>    
                                    <input data-date-input="" name="end_date" value="" required readonly
                                    placeholder="请选择截止日期" 
                                    class="layui-input" autocomplete="off">
                                </div>
                            </div>
                        </div>
                  
                    </div>
                </div>
                <div class="con_title">
                    <span class="con_title_line"></span>
                    <span>保险信息</span>
                </div>
                <div class="add-table">
                    <table  class="layui-table table-add" lay-skin="nob">
                        <colgroup>
                            <col width="184">
                            <col width="230">
                            <col width="608">                           
                          </colgroup>
                          <thead>
                            <tr>
                                <th>保险类型</th>
                               
                                <th>截止日期</th>
                                <th>备注信息</th>
                              
                            </tr> 
                          </thead>
                          <tbody>
                          	{notempty name='list'}
                          	{foreach $list as $key=>$vo}
                            <tr>
                              <td>
                              	{foreach $insurances as $k=>$v}
	                                {if  $vo.insurance eq $k}
	                                {$v}
	                                {/if}
	                            {/foreach}	
                              </td>
                              <td> 
                                <div class="input-item input-icon">
                                    <i class="iconfont iconcontract2-fill"></i>  
                                    <input data-date-input="" placeholder="请选择" data-type = "{$vo.insurance}" required="required" name="insurance_end_date[]"  value="" class="layui-input" autocomplete="off">
                                 </div>
                              </td>
                              <td> <input type="text" name="insurance_desc[]" {if  $vo.insurance eq 3} placeholder="如需领取失业金，请备注" {else/} placeholder="请输入" {/if} class="layui-input">   </td>
								<input type="hidden" name="insurance[]"  value="{$vo.insurance}" />
							</tr>
							{/foreach}
							{/notempty}	
                          </tbody>
                    </table>
                    <input type='hidden' value='{$increase.id}' name='increase_id'>
                </div>
                <div class="add-obj">
                    <a class="add-back" onclick="window.history.back()">返回</a>
                    <a class="add-updata" onclick="$('form').submit()">提交</a>
                </div>
            </form>
			

		</div>
    </section>
{/block}
{block name="style"}
    <style>
        .layui-table tbody tr:hover{
            background-color: #fff;
        }
        .layui-table tbody tr td:nth-child(3) input{
            width: 648px;
        }
        .layui-input-inline  input[name='end_date']{
            border: 1px solid #e5e5e5;
            background: #fff;
            color: #9c9cae;
            cursor: auto;
        }
        .layui-input-inline  input[name='end_date']:focus {
            border: 1px solid #61cad7 !important;
        }
    </style>
{/block}
{block name="script"}
<script>
    //限制截止日期为上月及以后
    var endDate = laydate.render({
        elem: 'input[name="end_date"]',
        format: 'yyyy-MM-dd',
        type:'date',
        min:getFirstOfLastMonth(),
        done: function (value) {
            $(this.elem).val(value).trigger('change');
        }
    });
    $("[name='end_date']").change(function(){
        // $("[name^='insurance_end_date']").val($(this).val())

        var  val=$(this).val();
        $("[name^='insurance_end_date']").each(function(){
            var dataType=$(this).attr("data-type");
            $(this).val(val)
           
           
          
        })
        form.render();
    })
</script>

{/block}

